import cv2
import numpy as np

def get_rgb_mask(image, lower=[0, 0, 0], upper=[255, 255, 118]):
    # 将 lower 和 upper 转换为 NumPy 数组
    lower = np.array(lower, dtype="uint8")
    upper = np.array(upper, dtype="uint8")
    
    kernel_size = 7
    closing_kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (kernel_size, kernel_size))
    mask = cv2.inRange(image, lower, upper)
    mask = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, closing_kernel)
    return mask